<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QEventTransition Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QEventTransition Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QEventTransition class provides a <a href="qobject.html">QObject</a>-specific transition for Qt events.
<a href="#details">More...</a></p>

<p>Inherits <a href="qabstracttransition.html">QAbstractTransition</a>.</p><p>Inherited by <a href="qkeyeventtransition.html">QKeyEventTransition</a> and <a href="qmouseeventtransition.html">QMouseEventTransition</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qeventtransition.html#QEventTransition">__init__</a></b> (<i>self</i>, QState&#160;<i>sourceState</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qeventtransition.html#QEventTransition-2">__init__</a></b> (<i>self</i>, QObject&#160;<i>object</i>, QEvent.Type&#160;<i>type</i>, QState&#160;<i>sourceState</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qeventtransition.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />QObject <b><a href="qeventtransition.html#eventSource">eventSource</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qeventtransition.html#eventTest">eventTest</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" />QEvent.Type <b><a href="qeventtransition.html#eventType">eventType</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qeventtransition.html#onTransition">onTransition</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qeventtransition.html#setEventSource">setEventSource</a></b> (<i>self</i>, QObject&#160;<i>object</i>)</li><li><div class="fn" /><b><a href="qeventtransition.html#setEventType">setEventType</a></b> (<i>self</i>, QEvent.Type&#160;<i>type</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QEventTransition class provides a <a href="qobject.html">QObject</a>-specific transition for Qt events.</p>
<p>A QEventTransition object binds an event to a particular
<a href="qobject.html">QObject</a>. QEventTransition is part of
<a href="statemachine-api.html">The State Machine
Framework</a>.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>button <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;
 <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s1 <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;
 <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s2 <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>;
 <span class="comment">// If in s1 and the button receives an Enter event, transition to s2</span>
 <span class="type">QEventTransition</span> <span class="operator">*</span>enterTransition <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QEventTransition</span>(button<span class="operator">,</span> <span class="type"><a href="qevent.html">QEvent</a></span><span class="operator">.</span>Enter);
 enterTransition<span class="operator">-</span><span class="operator">&gt;</span><a href="qabstracttransition.html#targetState-prop">setTargetState</a>(s2);
 s1<span class="operator">-</span><span class="operator">&gt;</span>addTransition(enterTransition);
 <span class="comment">// If in s2 and the button receives an Exit event, transition back to s1</span>
 <span class="type">QEventTransition</span> <span class="operator">*</span>leaveTransition <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QEventTransition</span>(button<span class="operator">,</span> <span class="type"><a href="qevent.html">QEvent</a></span><span class="operator">.</span>Leave);
 leaveTransition<span class="operator">-</span><span class="operator">&gt;</span><a href="qabstracttransition.html#targetState-prop">setTargetState</a>(s1);
 s2<span class="operator">-</span><span class="operator">&gt;</span>addTransition(leaveTransition);
</pre>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>When reimplementing the <a href="qeventtransition.html#eventTest">eventTest</a>() function, you
should first call the base implementation to verify that the event
is a <a href="qstatemachine-wrappedevent.html">QStateMachine.WrappedEvent</a>
for the proper object and event type. You may then cast the event
to a <a href="qstatemachine-wrappedevent.html">QStateMachine.WrappedEvent</a>
and get the original event by calling <a href="qstatemachine-wrappedevent.html#event">QStateMachine.WrappedEvent.event</a>(),
and perform additional checks on that object.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QEventTransition" />QEventTransition.__init__ (<i>self</i>, <a href="qstate.html">QState</a>&#160;<i>sourceState</i>&#160;=&#160;None)</h3><p>Constructs a new <a href="qeventtransition.html">QEventTransition</a> object with the given
<i>sourceState</i>.</p>


<h3 class="fn"><a name="QEventTransition-2" />QEventTransition.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>object</i>, <a href="qevent.html#Type-enum">QEvent.Type</a>&#160;<i>type</i>, <a href="qstate.html">QState</a>&#160;<i>sourceState</i>&#160;=&#160;None)</h3><p>Constructs a new <a href="qeventtransition.html">QEventTransition</a> object associated with
events of the given <i>type</i> for the given <i>object</i>, and
with the given <i>sourceState</i>.</p>


<h3 class="fn"><a name="event" />bool QEventTransition.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="eventSource" /><a href="qobject.html">QObject</a> QEventTransition.eventSource (<i>self</i>)</h3><h3 class="fn"><a name="eventTest" />bool QEventTransition.eventTest (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstracttransition.html#eventTest">QAbstractTransition.eventTest</a>().</p>


<h3 class="fn"><a name="eventType" /><a href="qevent.html#Type-enum">QEvent.Type</a> QEventTransition.eventType (<i>self</i>)</h3><h3 class="fn"><a name="onTransition" />QEventTransition.onTransition (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstracttransition.html#onTransition">QAbstractTransition.onTransition</a>().</p>
<h3 class="fn"><a name="setEventSource" />QEventTransition.setEventSource (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>object</i>)</h3><h3 class="fn"><a name="setEventType" />QEventTransition.setEventType (<i>self</i>, <a href="qevent.html#Type-enum">QEvent.Type</a>&#160;<i>type</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>